/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package acscoreserver.data;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author Ricardo
 */
@Entity
@Table(name = "game")
@NamedQueries({@NamedQuery(name = "Game.findAll", query = "SELECT g FROM Game g"), @NamedQuery(name = "Game.findById", query = "SELECT g FROM Game g WHERE g.id = :id"), @NamedQuery(name = "Game.findByMap", query = "SELECT g FROM Game g WHERE g.map = :map"), @NamedQuery(name = "Game.findByStarted", query = "SELECT g FROM Game g WHERE g.started = :started"), @NamedQuery(name = "Game.findByIdLogStarted", query = "SELECT g FROM Game g WHERE g.idLogStarted = :idLogStarted"), @NamedQuery(name = "Game.findByEnded", query = "SELECT g FROM Game g WHERE g.ended = :ended"), @NamedQuery(name = "Game.findByIdLogEnded", query = "SELECT g FROM Game g WHERE g.idLogEnded = :idLogEnded")})
public class Game implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Integer id;
    @Basic(optional = false)
    @Column(name = "map")
    private String map;
    @Basic(optional = false)
    @Column(name = "started")
    @Temporal(TemporalType.TIMESTAMP)
    private Date started;
    @Basic(optional = false)
    @Column(name = "id_log_started")
    private int idLogStarted;
    @Column(name = "ended")
    @Temporal(TemporalType.TIMESTAMP)
    private Date ended;
    @Column(name = "id_log_ended")
    private Integer idLogEnded;

    public Game() {
    }

    public Game(Integer id) {
        this.id = id;
    }

    public Game(Integer id, String map, Date started, int idLogStarted) {
        this.id = id;
        this.map = map;
        this.started = started;
        this.idLogStarted = idLogStarted;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getMap() {
        return map;
    }

    public void setMap(String map) {
        this.map = map;
    }

    public Date getStarted() {
        return started;
    }

    public void setStarted(Date started) {
        this.started = started;
    }

    public int getIdLogStarted() {
        return idLogStarted;
    }

    public void setIdLogStarted(int idLogStarted) {
        this.idLogStarted = idLogStarted;
    }

    public Date getEnded() {
        return ended;
    }

    public void setEnded(Date ended) {
        this.ended = ended;
    }

    public Integer getIdLogEnded() {
        return idLogEnded;
    }

    public void setIdLogEnded(Integer idLogEnded) {
        this.idLogEnded = idLogEnded;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Game)) {
            return false;
        }
        Game other = (Game) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "acscoreserver.Game[id=" + id + "]";
    }

}
